package com.yanqu.road.dataHelper.del.mgr.task;

import com.yanqu.road.dataHelper.DelScript;
import com.yanqu.road.dataHelper.manager.ServerMgr;
import com.yanqu.road.utils.executor.GeneralTask;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.List;

public class CrossDelTask extends GeneralTask {
    @Override
    public void doRun() {
        List<Long> serverList = DelScript.getMgr(ServerMgr.class).getWhereServer(DelScript.getWhereStr());
        try {
            Class actionClass = Class.forName("com.yanqu.road.dataHelper.del." + DelScript.getRepairClassName().trim());
            Method method = actionClass.getMethod("go",new Class[]{List.class});
            Constructor c = actionClass.getConstructor();
            Object actionObject = c.newInstance();
            method.invoke(actionObject, new Object[]{serverList});
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
